home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 July / Macworld (1999-07).dmg / Shareware World / Info / For Developers / Mops 3.4.sea / Mops source / Toolbox classes / Window < prev    next >
Text File  |  1998-09-21  |  3KB  |  132 lines

  1. \ Window class.
  2.  
  3. \  May    91 mrh    Added NonScrollWind.
  4. \        Default grow and drag limits set at grow and drag time.
  5. \        Also fixed a number of long-standing bugs in draw:, enable:, disable:
  6. \        etc.  New: deactivates current window.  Added PenIntoWind:.
  7. \  July 91 mrh    Moved Window class into module WindowMod.
  8. \  Sept 97 mrh    Updated for PowerMops
  9.  
  10.         variable    THEWINDOW
  11.   -1    constant    INFRONT
  12.         variable    THEPORT
  13.  129    constant    THUMB
  14.  
  15.    0    constant    DOCWIND
  16.   16    constant    RNDWIND
  17.    1    constant    DLGWIND
  18.  
  19.  
  20.     0    value    SaveActW    \ Saves actW over Suspend-Resume
  21.  
  22. forward    WHRFEV                \ Will become  where: fEvent
  23.  
  24. syscall    TextFont
  25. syscall    TextFace
  26. syscall    TextMode
  27. syscall    TextSize
  28. syscall DrawGrowIcon
  29. syscall CloseWindow
  30. syscall BeginUpdate
  31. syscall EndUpdate
  32. syscall SelectWindow
  33. syscall FrontWindow
  34. syscall DragWindow
  35. syscall SizeWindow
  36. syscall MoveWindow
  37. syscall TrackBox
  38. syscall ZoomWindow
  39. syscall GrowWindow
  40. syscall SetWTitle
  41. syscall GetWTitle
  42. syscall ShowWindow
  43. syscall HideWindow
  44. syscall NewWindow
  45. sysCall NewCWindow
  46. syscall GetNewWindow
  47. syscall GetNewCWindow
  48.  
  49.  
  50.  
  51. \ NoClip is a very useful word...
  52.  
  53. : NOCLIP    0 0 32766 dup  put: tempRect  addr: tempRect  ClipRect  ;
  54.  
  55.  
  56. \ ( val -- )  These next words set text characteristics for current grafPort
  57.  
  58. : TFONT        TextFont  ;
  59. : TFACE        TextFace  ;
  60. : TMODE        TextMode  ;
  61. : TSIZE        TextSize  ;
  62.  
  63. : INITFONT    9 tsize  4 tfont ( Monaco )  0 tMode  0 tFace  ;
  64.  
  65. PPC?
  66. [IF]
  67.  
  68. : TBOOL        \ ( b -- bool )  Makes a Mops boolean into a Toolbox boolean
  69.     inline{ 1 and }  ;
  70.     
  71. [ELSE]
  72.  
  73. : TBOOL        \ ( b -- bool )  Makes a Mops boolean into a Toolbox boolean
  74.     $ 100  and  makeint  ;
  75.  
  76. [THEN]
  77.  
  78.  
  79. \ Save and restore the GrafPort
  80.  
  81. : SAVEPORT    thePort    GetPort  ;
  82. : RESTPORT    thePort @  SetPort  ;
  83.  
  84. \ Utility routines for calculating a scroll bar's position.
  85.  
  86. : >VRECT  { left top rt bot -- l' t' r' b' }
  87.     rt 15 -    top 1-    rt 1+    bot 14 -   ;
  88.  
  89. : >HRECT  { left top rt bot -- l' t' r' b' }
  90.     left 1-    bot 15 -    rt 14 -    bot 1+   ;
  91.  
  92.  
  93. from WindowMod  import{  WINDOW  }
  94.  
  95. compile: windowMod
  96. true  setinstall: windowMod
  97.  
  98.  
  99. \ NonScrollWind is a window that will not scroll.  This preserves fprect which we
  100. \  may be using for scrolling text somewhere else.
  101.  
  102. :class    NONSCROLLWIND    super{ window }
  103.  
  104. :m CLASSINIT:
  105.     classinit: super  false setScroll: self   ;m
  106.  
  107. ;class
  108.  
  109.  
  110.  
  111. fWind  ' window  set_class
  112. classinit: fWind    markalive: fWind
  113.  
  114.  
  115. true value    fWindActive?    \ Will be true only when fwind is active.
  116.                             \ It is set/reset by enFW and disFW (see
  117.                             \ FEMod.txt).
  118.  
  119. : resize_fWind  { \ l t r b -- }
  120.                 \ resizes fWind according to the current screen.
  121.     fWind?  0EXIT
  122.     getRect: fWind  -> b -> r -> t -> l
  123.     screenbits  ( -- l t r b )
  124.     2/        b max  -> b
  125.     2/        r max  -> r  2drop
  126.     r b  size: fWind
  127.     noClip
  128. ;
  129.  
  130. resize_fWind
  131.  
  132.